<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header2', 'admin');
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>Metronic | Form Stuff - Form Layouts</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<!--
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
-->
<link href="<?php echo CSS_PATH?>metronic/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<!-- <link href="<?php echo CSS_PATH?>metronic/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/> -->
<link href="<?php echo CSS_PATH?>metronic/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH?>metronic/select2/select2.css"/>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN THEME STYLES -->


<link href="<?php echo CSS_PATH?>metronic/components.css" id="style_components" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/plugins.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="<?php echo CSS_PATH?>metronic/darkblue.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>metronic/custom.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>select_xiala.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo CSS_PATH?>table_form.css" rel="stylesheet" type="text/css" />
<link href="<?php echo JS_PATH?>images/uploader.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/jscal2.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/border-radius.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH?>calendar/win2k.css"/>
<script type="text/javascript" src="<?php echo JS_PATH?>calendar/calendar.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH?>calendar/lang/en.js"></script>
<script src="<?php echo JS_PATH?>PCASClass.js"></script>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed page-quick-sidebar-over-content ">
<!-- BEGIN HEADER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div>
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-xs-2">
					<div class="tabbable-line boxless tabbable-reversed">
						<div class="tab-content">
							<div >
								<div style="background-color: #e2e8f7;padding: 9px;color: black;">
									<h1 class="text-center"><?php echo $patients_data['patient_name']?></h1><br>
									<p class="text-center">
										<?php echo $patients_data['sex']?>
										<?php echo $patients_data['age']?>
										<?php echo $patients_data['address']?>
									</p>
									<p class="text-center">
										<h>电话：<?php echo $patients_data['phone']?></h>
										
									</p>
									<p class="text-center">
										<h>档案号：<?php echo $patients_data['archives_num']?></h>
									</p>		
								</div>
								<?php if(is_array($data)){foreach($data as $v){?>  
								<p class='text-center' style="background-color: #5a99fb;padding: 13px;margin-top: 4px;    border-radius: 6px !important;">
									<a style="color:white" href="javascript:editRecord('<?php echo $v['id']?>')"><?php echo $v['clinic_time']?></a>
								</p>
										
								<?php }} ?>
									
							</div>	
						</div>
					</div>
				
				</div>
				<div class="col-xs-10">
					<div class="tabbable-line boxless tabbable-reversed">
						<div class="tab-content">
							<div class="tab-pane active" id="tab_0">
								<div class="">
									
									<div class="portlet-body form">
										<h><strong>添加病历：</strong></h>
										<h3 style="float:right;margin-right: 100px"><a href="/boneDatabase/index.php?m=admin&c=boneDatabase&a=patients_info">回到主页</a></h3>
										<!-- BEGIN FORM-->
										<ul id="myTabs" class="nav nav-tabs" role="tablist">
		          							<li role="presentation" class="active">
		           								 <a href="#bone" id="bone-tab" role="tab" data-toggle="tab" aria-controls="bone" aria-expanded="true">病史输入</a>
		          							</li>
		          						<li role="presentation" >
		            						<a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" >体格检查</a>
		          						</li>
		          						<li role="presentation">
		           								 <a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile">影像诊断</a>
		          						</li>
		          
		        						</ul>
	        
										<form name="myform" action="?m=admin&c=boneDatabase&a=medicalRecord_add" method="post" id="myform" class="form-horizontal">
											<div class="form-body">
												<div id="myTabContent" class="tab-content">
          											<div role="tabpanel" class="tab-pane fade in active" id="bone" aria-labelledby="bone-tab">
          											<div class="col-xs-6">
	          											<div class="form-group">
															<label class="col-xs-12 pullleft">
															就诊时间
															<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span>
															</label>
															<div class="col-xs-12">
																<input type="text" value="" name="clinic_time" id="clinic_time" size="10" class="selectadd date" placeholder="2017-01-01">
																	<script type="text/javascript">
																		Calendar.setup({
																		weekNumbers: true,
																		inputField : "clinic_time",
																		trigger    : "clinic_time",
																		dateFormat: "%Y-%m-%d",
																		showTime: false,
																		minuteStep: 1,
																		onSelect   : function() {this.hide();}
																		});
																	</script>
															</div>
														</div>

														<div class="form-group">
															<label class="col-xs-12 pullleft">
																医院号
																<span class="glyphicon glyphicon-star star" style="color:#618ee2;font-size: 12px" aria-hidden="true" ></span>
                                                                <select name="hospital_num" id="hospital_num"  style="width:110px" >
                                                                    <option value="" selected="">请选择</option>
                                                                    <?php if(is_array($hospital_data) ){foreach($hospital_data as $v){?>
                                                                        <option value="<?php echo $v['hospitalnum'] ?>" <?php if($part == $v['hospitalnum']){ echo 'selected';}?> >
                                                                            <?php echo $v['hospitalnum'] ?>
                                                                        </option>
                                                                    <?php }} ?>
                                                                </select>
															</label>

														</div>
														<div class="form-group">
															<label class="col-xs-12 pullleft">
																主诉<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span>
															</label>
															<div class="col-xs-12">
																<input type="text" name="chief_complaint" id="chief_complaint" class="form-control input-circle" autofocus value="<?php echo $chief_complaint?>" placeholder="请输入">

															</div>
														</div>
														<div class="form-group">
															<label class="col-xs-12 ">
																既往史<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true">
																</span>
																<label class="radio-inline">
  																		<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="previous_history" id="previous_historyy" value="有" checked="">
  																		<h style="position: relative; top: -19px;">有</h>
																</label>
																<label class="radio-inline">
  																	<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="previous_history" id="previous_historyn" value="无" >
  																	<h style="position: relative; top: -19px;">无</h>
																</label>
															</label>
														</div>
														<div class="form-group">

															<div class="col-xs-12">
																<!--  -->
																<textarea autofocus class="form-control testarea" rows="3" name="previous_history_desc" id="previous_history_desc" placeholder="描述" ></textarea>
															</div>
														</div>

														<div class="form-group">
															<label class="col-xs-12 pullleft">家族史
																<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span>
																<label class="radio-inline">
  																		<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="family_history" id="family_historyy" value="有" checked="">
  																		<h style="position: relative; top: -19px;">有</h>
																</label>
																<label class="radio-inline">
  																	<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="family_history" id="family_historyn" value="无" >
  																	<h style="position: relative; top: -19px;">无</h>
																</label>
															</label>
														</div>
														<div class="form-group">
															<div class="col-xs-12">
																<textarea autofocus class="form-control testarea" rows="3" name="family_history_desc" id="family_history_desc" placeholder="描述"></textarea>
															</div>
														</div>
														<div class="form-group">
															<label class="col-xs-12 pullleft">过敏史
															<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span>
																<label class="radio-inline">
  																		<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="allergic_history" id="allergic_historyy" value="有" checked="" >
  																		<h style="position: relative; top: -19px;">有</h>
																</label>
																<label class="radio-inline">
  																	<input autofocus type="radio" class="mgr mgr-primary mgc-circle" name="allergic_history" id="allergic_historyn" value="无" >
  																	<h style="position: relative; top: -19px;">无</h>
																</label>
															</label>

														</div>
														<div class="form-group">
															<div class="col-xs-12">
																<textarea autofocus class="form-control testarea" rows="3" name="allergic_history_desc" id="allergic_history_desc" placeholder="描述"></textarea>
															</div>
														</div>
          											</div>
          											<div class="col-xs-6">

														<div class="form-group">
															<label class="col-xs-12 pullleft">兼用药情况
															    <span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span>
															    <label class="radio-inline">
  																		<input type="radio" class="mgr mgr-primary mgc-circle" name="drug_use" id="drug_usey" value="有" checked="" >
  																		<h style="position: relative; top: -19px;">有</h>
																</label>
																<label class="radio-inline">
  																	<input type="radio" class="mgr mgr-primary mgc-circle" name="drug_use" id="drug_usen" value="无" >
  																	<h style="position: relative; top: -19px;">无</h>
																</label>
															</label>

														</div>
														<div class="form-group">

															<div class="col-xs-12" style="background-color:#eef2f9; ">
																<input type="hidden" id='drug_use_reason' name="drug_use_reason" value=""/>
																<input type="hidden" id="drug_name" name="drug_name" value=""/>
																<input type="hidden" id="use_way" name="use_way" value=""/>
																<input type="hidden"  id="start_time" name='start_time' value=""  />


																<table id="drug_use_table" class="datatable-table" style="height:30px; " cellspacing="0" width="90%">
																<thead>
																	<tr style="background-color: #c7ddff;height: 40px;">
																		<th>使用原因</th>
																		<th>药物名称</th>
																		<th>用法用量</th>
																		<th>开始用药时间</th>
																	</tr>
																</thead>
																</table>
																<div class="text-center" id="buttonadd">
																	<button id="drug_use_addbtn" class="btn btn-circle blue">添加</button>
																    <button id="drug_use_delbtn" class="btn btn-circle blue">删除</button>
																</div>

															</div>
														</div>

														<div class="form-group">
															<label class="col-xs-12 pullleft" style="height:56px">西医诊断<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span></label>
															<div class="col-xs-12">

																<textarea class="form-control testarea" rows="3" name="western_diagnose" id="western_diagnose" placeholder="描述"></textarea>
															</div>
														</div>
														<div class="form-group">
															<label class="col-xs-12 pullleft" style="height:56px">中医诊断<span class="glyphicon glyphicon-star star"  style="color:#618ee2;font-size: 12px" aria-hidden="true"></span></label>
															<div class="col-xs-12">
																
																<textarea class="form-control testarea" rows="3" name="chinese_diagnose" id="chinese_diagnose" placeholder="描述" ></textarea>
															</div>
														</div>
          											</div>
													
	         									</div>
          										<div role="tabpanel" class="tab-pane fade" id="home"  aria-labelledby="home-tab">
            										<div class="form-group">
													<label  class="col-xs-12 pullleft">身高</label>
														<div class="col-xs-6">
															<input type="text" name="height" id="height"  class="form-control input-circle" value="" placeholder="请输入">
														</div>
														<div class="col-xs-6">
															cm
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">体重</label>
														<div class="col-xs-6">
															<input type="text" name="weight" id="weight"  class="form-control input-circle" value="" placeholder="请输入">
														</div>
														<div class="col-xs-6">
															kg
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">体温</label>
														<div class="col-xs-6">
															<input type="text" name="body_temperature" id="body_temperature"  class="form-control input-circle" value="" placeholder="请输入">
														</div>
														<div class="col-xs-6">
															℃
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">心率</label>
														<div class="col-xs-6">
															<input type="text" name="heart_rate" id="heart_rate"  class="form-control input-circle" value="" placeholder="请输入">
														</div>
														<div class="col-xs-6">
														次/分钟
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">心律</label>
														<div class="col-xs-6">
															<select  name="heart_rhythm" class="selectadd">
																<option value="齐">齐</option>
																<option value="不齐">不齐</option>
															</select>
														</div>

													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">呼吸</label>
														<div class="col-xs-6">
															<input type="text" name="breath" id="breath"  class="form-control input-circle" value="" placeholder="请输入">
														</div>
														<div class="col-xs-6">
														次/分钟
														</div>
													</div>
													<div class="form-group">
														<label class="col-xs-12 pullleft">血压</label>
														<div class="col-xs-3">
															<input type="text" name="sitting_blood_pressure"   class="form-control input-circle" placeholder="坐位" value="">
														</div>
														
														<h style="float:left;margin-top: 9px;">/</h>
														
														<div class="col-xs-3">
															
															<input type="text" name="leftarm_blood_pressure"   class="form-control input-circle" placeholder="左臂" value="">
														</div>
														<div class="col-xs-4">
																mmHg
														</div>
													</div>
													
                                                </div>
         										<div role="tabpanel" class="tab-pane fade" id="profile" aria-labelledby="profile-tab">	

            										<div class="form-group" style="margin-top: 30px">
														<label class="col-xs-1 control-label">X片</label>
														<div class="col-xs-11">
															<input type="hidden" name="X_ray" id="X_ray"  value=""/>
															<input type="hidden" name="X_ray_hipjoint" id="X_ray_hipjoint" value=""/>
															<input type="hidden" name="X_raylink" id="X_raylink" value=""/>
															<input type="hidden" name="X_raydesc" id="X_raydesc" value=""/>
															
															
															<table id="X_ray_table" class="datatable-table" style="min-height:30px;" cellspacing="0" width="90%">
															<thead>
																<tr>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																</tr>
															</thead>
															</table>
															<div class="text-center">
															 	<button id="X_ray_addbtn" class="btn btn-circle blue">添加</button>
																<button id="X_ray_delbtn" class="btn btn-circle red">删除</button>

														    </div>
														</div>
													</div>
													<div class="form-group" style="margin-top: 50px">
														<label class="col-xs-1 control-label" >CT片</label>
														<div class="col-xs-11">
															<input type="hidden" name="CT" id="CT"  value=""/>
															<input type="hidden" name="CT_hipjoint" id="CT_hipjoint" value=""/>
															<input type="hidden" name="CT_link" id="CT_link" value=""/>
															<input type="hidden" name="CT_desc" id="CT_desc"  value=""/>
															
															
															<table id="CT_table" class="datatable-table" style="min-height:30px;" cellspacing="0" width="90%">
															<thead>
																<tr>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																</tr>
															</thead>
															</table>
															<div class="text-center">	
																<button id="CT_addbtn" class="btn btn-circle blue">添加</button>
																<button id="CT_delbtn" class="btn btn-circle red">删除</button>
															</div>
															
														</div>
													</div>
													<div class="form-group " style="margin-top: 50px" >
														<label class="col-xs-1 control-label ">MRI</label>
														<div class="col-xs-11">
															<input type="hidden" name="MRI" id="MRI"   value=""/>
															<input type="hidden" name="MRI_hipjoint" id="MRI_hipjoint" value=""/>
															<input type="hidden" name="MRI_link" id="MRI_link" value=""/>
															<input type="hidden" name="MRI_desc" id="MRI_desc"  value=""/>
															
															
															<table id="MRI_table" class="datatable-table" style="min-height:30px;" cellspacing="0" width="90%">
															<thead>
																<tr>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																	<th></th>
																</tr>
															</thead>
															</table>
															<div class="text-center">
																<button id="MRI_addbtn" class="btn btn-circle blue">添加</button>
															    <button id="MRI_delbtn" class="btn btn-circle red">删除</button>
															</div>
															
														</div>
													</div>
          								        </div>
         
                       						</div>
												
													
											</div>
											<div class="form-actions">
												<div class="row">
													<input type="hidden" name="patients_id" value="<?php echo $patients_id ?>" >
													<div class="col-xs-offset-8 col-xs-12">
														 <button name="dosubmit" id="dosubmit" style="width: 13%;" class="btn btn-circle blue" type="submit"><?php echo L('保存病历')?></button>
														 <a class="btn btn-circle blue" style="width: 13%;" onclick="history.go(-1)">返回</a>
													</div>
												</div>
											</div>
										</form>
										<!-- END FORM-->
									</div>
								</div>
						</div>
					</div>
				</div>
			</div>
			<!-- END PAGE CONTENT-->
		</div>
	</div>
	<!-- END CONTENT -->
</div>
<!-- [if lt IE 9]> -->
<script src="<?php echo CSS_PATH?>metronic/respond.min.js"></script>
<script src="<?php echo CSS_PATH?>metronic/excanvas.min.js"></script> 
<!-- <![endif] -->
<!-- <script type="text/javascript" src="jquery-1.8.0.min.js"></script> -->


<script src="<?php echo CSS_PATH?>metronic/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="<?php echo CSS_PATH?>metronic/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery.blockui.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/jquery.cokie.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="<?php echo CSS_PATH?>metronic/select2/select2.min.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="<?php echo CSS_PATH?>metronic/metronic.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/layout.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/quick-sidebar.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/demo.js" type="text/javascript"></script>
<script src="<?php echo CSS_PATH?>metronic/form-samples.js"></script>
<script src="<?php echo JS_PATH?>formvalidator.js"></script>
<script src="<?php echo JS_PATH?>formvalidatorregex.js"></script>
<script src="<?php echo JS_PATH?>images/fine-uploader.core.min.js"></script>
<script src="<?php echo JS_PATH?>images/uploader.js"></script>
<script src="<?php echo JS_PATH?>datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo JS_PATH?>datatables/dataTables.scroller.min.js"></script>
<script src="<?php echo JS_PATH?>datatables/table.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script type="text/javascript">
	
	function editRecord(id){
	location.href ='?m=admin&c=boneDatabase&a=medicalRecord_edit&id='+id+'&pc_hash='+pc_hash+'&goback='+BASE64.encode(location.search);
}

</script>
<script type="text/javascript" src="statics/js/base64.js"></script>
<script>
jQuery(document).ready(function() {    
   // initiate layout and plugins
   Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
   FormSamples.init();
});
</script>
<script type="text/javascript">
  $(document).ready(function() {
      $('#previous_historyy').click(function(){
          $('#previous_history_desc').show();
      });
      $('#previous_historyn').click(function(){
          $('#previous_history_desc').hide();
      });
      //family_history
      $('#family_historyy').click(function(){
          $('#family_history_desc').show();
      });
      $('#family_historyn').click(function(){
          $('#family_history_desc').hide();
      });
      //allergic_history
      $('#allergic_historyy').click(function(){
          $('#allergic_history_desc').show();
      });
      $('#allergic_historyn').click(function(){
          $('#allergic_history_desc').hide();
      });
//drug_usen buttonadd
      $('#drug_usey').click(function(){
          $('#drug_use_table_wrapper').show();
          $('#buttonadd').show();

      });
      $('#drug_usen').click(function(){
          $('#drug_use_table_wrapper').hide();
          $('#buttonadd').hide();
      });

  
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});



      $("#hospital_num").formValidator({onshow:"<?php echo L('请选择').L('医院号')?>",onfocus:"<?php echo L('请选择').L('医院号')?>"}).inputValidator({min:1,max:30,onerror:"<?php echo L('请选择').L('医院号')?>"});
      $("#chief_complaint").formValidator({onshow:"<?php echo L('请输入').L('主诉')?>",onfocus:"<?php echo L('请输入').L('主诉')?>"}).inputValidator({min:1,max:30,onerror:"<?php echo L('请输入').L('主诉')?>"});
      $("#western_diagnose").formValidator({onshow:"<?php echo L('请输入').L('西医诊断')?>",onfocus:"<?php echo L('请输入').L('西医诊断')?>"}).inputValidator({min:1,max:200,onerror:"<?php echo L('请输入').L('西医诊断')?>"});
      $("#chinese_diagnose").formValidator({onshow:"<?php echo L('请输入').L('中医诊断')?>",onfocus:"<?php echo L('请输入').L('中医诊断')?>"}).inputValidator({min:1,max:200,onerror:"<?php echo L('请输入').L('中医诊断N')?>"});

      $("#clinic_time").formValidator({onshow:"<?php echo L('请选择').L('就诊时间')?>",onfocus:"<?php echo L('请选择').L('就诊时间')?>"}).inputValidator({min:1,max:30,onerror:"<?php echo L('请选择').L('就诊时间')?>"}).ajaxValidator({
	     type : "get",
	 	url : "",
	 	data :"m=admin&c=boneDatabase&a=check_clinic_time_ajx&patients_id=<?php echo $patients_data['id']?>",
	 	datatype : "html",
	 	async:'false',
	 	success : function(data){
             if( data == "1" )
	 		{
                 return true;
	 		}
             else
	 		{
                 return false;
	 		}
	 	},
	 	buttons: $("#dosubmit"),
	 	onerror : "<?php echo L('就诊时间已经存在')?>",
	 	onwait : "<?php echo L('检查中')?>"

	 })
	

	//  $("#sort").formValidator({ // 验证：模块名称
	//  		onshow: "（必填，数字越大越靠前）",
 //            onfocus: "（必填，正整数，数字越大越靠前）",
 //            oncorrect: "（正确）"
 //        }).inputValidator({
 //            min: 1,
 //            max: 10000000,
 //            type: "value",
 //            onerrormin: "（错误）不能为空",
 //            onerrormax: "（错误）超过范围"
 //        });
  
 //药用情况
		var dt_drug =dataTableWrapper({
			table : $("#drug_use_table"),
			add_btn : $("#drug_use_addbtn"),
			del_btn : $("#drug_use_delbtn"),
			add_row_before_func : function(){
				var count = getMaxTrCount("#drug_use_table .small") + 1;
			
				return [
				'<textarea type="text"  class="short-input datables reason" count='+count+'  value=""></textarea>',
				
				'<textarea type="text"  class="short-input datables  name" count='+count+'  value=""></textarea>',
				'<textarea type="text"  class="short-input datables  useway" count='+count+'   value=""></textarea>',
				
				'<textarea type="text" id="starttime" placeholder="格式：2016-01-01" class="short-input datables time"  value=""></textarea> '
			];}
			
		});
//x-ray
 	var dt_X_ray = dataTableWrapper({
			table : $("#X_ray_table"),
			add_btn : $("#X_ray_addbtn"),
			del_btn : $("#X_ray_delbtn"),
			add_row_before_func : function(){
				var count = getMaxTrCount("#X_ray_table .small") + 1;
				
				return [
				'检测结果：<select  class="X_ray datablesadd"> <option value="正常">正常</option><option value="异常">异常</option></select>',
				'髋关节部位<select class="X_ray_hipjoint datablesadd" > <option>部位1</option><option>部位2</option></select>',
				'X_ray片<textarea type="text"  class="short-input small datablesadd" count='+count+'  id="X_raypicurl_'+count+'" value=""></textarea>',
				'<button id="X_ray_btn_'+count+'" class="button" style="font-size:12px;width: 45px;">上传</button><div id="X_raypic_img_'+count+'" class="upload-box datablesadd" ></div>',
				'<div class="">描述<textarea type="text"  class="short-input X_ray_desc datablesadd"  value=""></textarea>'


			];},
			add_row_after_func : function(){
				var i = getMaxTrCount("#X_ray_table .small");
				imageUploaderWrapper({
					 prefix:"<?php echo pc_base::load_config('system', 'upload_prefix')?>",
					 launch_button:$('#X_ray_btn_'+i),
					 image_container:$('#X_raypic_img_'+i),
					 url_input:$('#X_raypicurl_'+i)
				 });
				
			}
			
		});
//	CT片
 		var dt_CT = dataTableWrapper({
			table : $("#CT_table"),
			add_btn : $("#CT_addbtn"),
			del_btn : $("#CT_delbtn"),
			add_row_before_func : function(){
				var count = getMaxTrCount("#CT_table .small") + 1;
				var hidden = (count>0)?" style='visibility:hidden' ":"";
				return [
				'检测结果:<select class="CT datablesadd"> <option value="正常">正常</option><option value="异常">异常</option></select>',
				'髋关节部位<select class="CT_hipjoint datablesadd"> <option>部位1</option><option>部位2</option></select>',
				'CT片<textarea type="text"  class="short-input small datablesadd" count='+count+'  id="CTpicurl_'+count+'" value=""></textarea>',
				'<button id="CT_btn_'+count+'" class="button" style="font-size:12px;width:45px;">上传</button><div id="CTpic_img_'+count+'" class="upload-box datablesadd" ></div>',
				'描述<textarea type="text" class="CT_desc datablesadd"   value=""></textarea>'


			];},
			add_row_after_func : function(){
				var i = getMaxTrCount("#CT_table .small");
				imageUploaderWrapper({
					 prefix:"<?php echo pc_base::load_config('system', 'upload_prefix')?>",
					 launch_button:$('#CT_btn_'+i),
					 image_container:$('#CTpic_img_'+i),
					 url_input:$('#CTpicurl_'+i),
				 });
				
			}
			
		});
//	MRI
 		var dt_MRI = dataTableWrapper({
			table : $("#MRI_table"),
			add_btn : $("#MRI_addbtn"),
			del_btn : $("#MRI_delbtn"),
			add_row_before_func : function(){
				var count = getMaxTrCount("#MRI_table .small") + 1;
				var hidden = (count>0)?" style='visibility:hidden' ":"";
				return [
				'检测结果：<select class="MRI datablesadd"> <option value="正常">正常</option><option value="异常">异常</option></select>',
				'髋关节部位<select class="MRI_hipjoint datablesadd"> <option>部位1</option><option>部位2</option></select>',
				'MRI<textarea type="text"  class="short-input small datablesadd" count='+count+'  id="MRIpicurl_'+count+'" value=""></textarea>',
				'<button id="MRI_btn_'+count+'" class="button datablesadd" style="font-size:12px;width:45px">上传</button><div id="MRIpic_img_'+count+'" class="upload-box datablesadd" ></div>',
				'描述<textarea type="text" class="MRI_desc datablesadd" class="short-input datablesadd"  value=""></textarea>'


			];},
			add_row_after_func : function(){
				var i = getMaxTrCount("#MRI_table .small");
				imageUploaderWrapper({
					 prefix:"<?php echo pc_base::load_config('system', 'upload_prefix')?>",
					 launch_button:$('#MRI_btn_'+i),
					 image_container:$('#MRIpic_img_'+i),
					 url_input:$('#MRIpicurl_'+i),
				 });
				
			}
			
		});

		$('#dosubmit').click(function(){
			//药物使用原因
			inputs = dt_drug.$('textarea.reason');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#drug_use_reason").val(inputs_array.join(','));
			//药物名称
			inputs = dt_drug.$('textarea.name');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#drug_name").val(inputs_array.join(','));
			//药物使用方法
			inputs = dt_drug.$('textarea.useway');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#use_way").val(inputs_array.join(','));
			//用药时间
			inputs = dt_drug.$('textarea.time');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#start_time").val(inputs_array.join(','));


			//X_ray
			inputs = dt_X_ray.$('select.X_ray');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#X_ray").val(inputs_array.join(','));
			//X_ray_hipjoint
			inputs = dt_X_ray.$('select.X_ray_hipjoint');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#X_ray_hipjoint").val(inputs_array.join(','));
			//X_raylink
			inputs = dt_X_ray.$('textarea.small');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#X_raylink").val(inputs_array.join(','));
			//	X_raydesc
			inputs = dt_X_ray.$('textarea.X_ray_desc');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#X_raydesc").val(inputs_array.join(','));

			//CT
			inputs = dt_CT.$('select.CT');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#CT").val(inputs_array.join(','));
			//CT_hipjoint
			inputs = dt_CT.$('select.CT_hipjoint');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#CT_hipjoint").val(inputs_array.join(','));
			//CTlink
			inputs = dt_CT.$('textarea.small');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#CT_link").val(inputs_array.join(','));
			//	CTdesc
			inputs = dt_CT.$('textarea.CT_desc');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#CT_desc").val(inputs_array.join(','));
			//MRI
			inputs = dt_MRI.$('select.MRI');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#MRI").val(inputs_array.join(','));
			//MRI_hipjoint
			inputs = dt_MRI.$('select.MRI_hipjoint');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#MRI_hipjoint").val(inputs_array.join(','));
			//MRIlink
			inputs = dt_MRI.$('textarea.small');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#MRI_link").val(inputs_array.join(','));
			//	MRIdesc
			inputs = dt_MRI.$('textarea.MRI_desc');
			inputs_array = [];
			for(var i=0;i<inputs.length;i++){
				if(inputs[i].value.length > 0)
				inputs_array.push(inputs[i].value);
			}
			$("#MRI_desc").val(inputs_array.join(','));


			
		});

})
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>